import React, {Component} from 'react';

class Two extends Component {
    state = {
        num:1
    }
    render() {
        return (
            <div>
                <button onClick={()=>{
                    this.setState({
                        num:100
                    })
                }}>Two:{this.state.num}</button>
            </div>
        );
    }
    // 1- 组件挂载完毕之后执行
    // 2- 组件在整个生命周期中只执行一次。
    componentDidMount() {
        console.log("componentDidMount1")
    }
    componentDidMount(){
        console.log("componentDidMount2")
    }
    componentWillUnmount() {
        console.log("componentWillUnmount")
    }
}

export default Two;